/**
 * 认证路由
 * 处理用户注册、登录和认证
 */
const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/authMiddleware');
const {
  register,
  login,
  logout,
  verifyToken,
  getCurrentUser
} = require('../controllers/authController');

// 注册新用户
router.post('/register', register);

// 用户登录
router.post('/login', login);

// 用户登出
router.post('/logout', protect, logout);

// 验证令牌
router.get('/verify', protect, verifyToken);

// 获取当前登录用户信息
router.get('/me', protect, getCurrentUser);

module.exports = router; 